#! -*- coding: utf-8 -*-

"""
Baan xmlrpc client
"""

import xmlrpclib
import time
proxy = xmlrpclib.ServerProxy("http://localhost:8000/")


print proxy.test()
print proxy.baantest.test()
print proxy.baantest.get_company(400)

import threading


def thread_test():
    proxy = xmlrpclib.ServerProxy("http://localhost:8000/")
    for i in range(10):
        print i,
        print proxy.test(),
        print proxy.baantest.test(),
        print proxy.baantest.get_company(400)
        print 'wait',
        proxy.baantest.testwait()
        print 'end wait'
        time.sleep(1)


a = threading.Thread(target=thread_test)
b = threading.Thread(target=thread_test)
c = threading.Thread(target=thread_test)

a.start()
##b.start()
##c.start()

while threading.active_count() > 1:
    time.sleep(0.2)


